package com.lansea.wms.model;

import com.lansea.wms.entity.SerializeBase;
import com.lansea.wms.entity.ValidClass;
import com.lansea.wms.enums.CompanyCategoryEnum;
import com.lansea.wms.model.base.BaseUser;
import com.lansea.wms.util.DateUtil;
import com.lansea.wms.util.EnumUtil;
import com.lansea.wms.validate.Mobile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Repository;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.util.Date;
@Data
@Repository
@ApiModel(value = "Company", description = "第三方公司（客户，供应商）模型")
public class Company extends BaseUser {

    @ApiModelProperty(value = "ID")
    @Min(value = 1, message = "ID 非法", groups = {ValidClass.EditForm.class, ValidClass.FindIdForm.class})
    private Integer id;

    @ApiModelProperty(value = "编码")
    private String code;

    @ApiModelProperty(value = "分类 1:供应商，2：客户，3：承运商")
    @Min(value = 1, message = "分类非法")
    private Integer category;

    @ApiModelProperty(value = "公司全名")
    private String name;
    @ApiModelProperty(value = "地址必须为")
    private String address;

    @ApiModelProperty(value = "联系人名称")
    private String contactName;

    @ApiModelProperty(value = "座机")
    private String phone;

    @NotBlank(message = "手机号不能为空")
    @Mobile
    private String mobile;
    @Email(message = "email格式错误")
    private String email;

    private String remark;

    // 扩展字段

    @ApiModelProperty(value = "创建人")
    private String createUserName;
    @ApiModelProperty(value = "审批人")
    private String updateUserName;
    @ApiModelProperty(value = "分类名称")
    private String categoryName;



    public String getCategoryName() {
        return EnumUtil.valueOf(CompanyCategoryEnum.class, category).getValue();
    }





}
